package com.example.student.entity;

public class ApiResponse<T> {
    private int success;
    private String message;
    private T data;

    public ApiResponse(int success, String message, Object data) {
        this.success = success;
        this.message = message;
        this.data = (T) data;
    }

    // Default constructor for successful responses without data
    public ApiResponse(int success, String message) {
        this.success = success;
        this.message = message;
        this.data = null;
    }

    // Getters and setters for each field
    public int getSuccess() {
        return success;
    }

    public void setSuccess(int success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    // toString method for easy logging and debugging
    @Override
    public String toString() {
        return "ApiResponse{" +
                "success=" + success +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}